/**
 *
 */
package com.edooschool.webpay.dao;

import com.demo2do.core.persistence.annotation.Dao;
import com.demo2do.core.persistence.annotation.Execute;
import com.demo2do.core.persistence.annotation.Query;
import com.demo2do.core.persistence.annotation.Variable;
import com.edooschool.webpay.entity.PaymentContext;

/**
 * @author downpour
 *
 */
@Dao(value = "hibernate")
public interface PaymentDao {

    /**
     * load payment context by order_no and status
     *
     * @param token
     * @return
     */
    @Query("FROM PaymentContext WHERE token = :token")
    public PaymentContext get(@Variable("token") String token);
    
    @Execute("UPDATE PaymentContext SET transactionCode = :transactionCode, status = 1, hookTime = current_time, lastUpdateTime = current_time WHERE id = :id")
    public void finish(@Variable("id") Long id, @Variable("transactionCode") String transactionCode);
    
}
